package com.huawei.appgallery.wishlist.ui.cardkit.card;

import android.content.Context;
import android.graphics.Rect;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.huawei.appgallery.foundation.card.base.card.BaseDistCard;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appgallery.wishlist.ui.cardkit.bean.WishNoAppCardBean;
import o.azb;
import o.cgz;
import o.dce.e;
import o.epv;

public class WishNoAppCard extends BaseDistCard {
    private TextView ʽ;
    private LinearLayout ˋ;
    private int ॱॱ = 186;

    public WishNoAppCard(Context context) {
        super(context);
    }

    public cgz ˏ(View view) {
        this.ˋ = (LinearLayout) view.findViewById(e.ˏˏ);
        this.ʽ = (TextView) view.findViewById(e.ʽˊ);
        azb.ˋ(this.ʽ);
        ʽ(view);
        return this;
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        if (cardBean instanceof WishNoAppCardBean) {
            CharSequence ˊ = ((WishNoAppCardBean) cardBean).ˊ();
            if (!TextUtils.isEmpty(ˊ)) {
                this.ʽ.setText(ˊ);
            }
        }
    }

    public void ˎ(CardBean cardBean, ViewGroup viewGroup) {
        super.ˎ(cardBean, viewGroup);
        if (cardBean.ॱㆍ()) {
            ˎ();
        }
    }

    private void ˎ() {
        this.ˋ.post(new Runnable(this) {
            final /* synthetic */ WishNoAppCard ˎ;

            {
                this.ˎ = r1;
            }

            public void run() {
                int[] iArr = new int[2];
                this.ˎ.ˋ.getLocationInWindow(iArr);
                int height = iArr[1] + this.ˎ.ˋ.getHeight();
                Rect rect = new Rect();
                this.ˎ.ˋ.getWindowVisibleDisplayFrame(rect);
                int height2 = rect.height() + this.ˎ.ˎ(this.ˎ.ˉ().getContext());
                if (height2 > height) {
                    LayoutParams layoutParams = this.ˎ.ˋ.getLayoutParams();
                    layoutParams.height = (height2 - height) + this.ˎ.ˋ.getHeight();
                    this.ˎ.ˋ.setLayoutParams(layoutParams);
                    return;
                }
                LayoutParams layoutParams2 = this.ˎ.ˋ.getLayoutParams();
                layoutParams2.height = epv.ˋ(this.ˎ.ˉ().getContext(), this.ˎ.ॱॱ);
                this.ˎ.ˋ.setLayoutParams(layoutParams2);
            }
        });
    }

    private int ˎ(Context context) {
        int identifier = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
        if (identifier > 0) {
            return context.getResources().getDimensionPixelSize(identifier);
        }
        return 0;
    }
}
